package com.glela.ningchongqing;

import com.alibaba.fastjson.JSONObject;
import com.glela.common.util.HttpUtil;

public class 优惠券礼包测试 {
//	public final static String url = "http://api.xzhuang.com/v2/yg_platform/";
//	public final static String url = "http://api.test.xzhuang.com/yg_platform/";
	public final static String url = "http://api.dev.xzhuang.com/yg_platform/";
//	public final static String url = "http://192.168.50.120:8080/yg_platform/";
	
	public static void main(String[] args) {
		givePromotionPackage();
//		preLoadPromotionPackages();
//		getPromotionPackages();
	}
	
	/**
	 * 赠送礼包
	 */
	public static void givePromotionPackage() {
		JSONObject jo = new JSONObject();
		jo.put("giver", 6497);// 1704 6497
		jo.put("accepter", 671508);
		jo.put("promotionId", 25);// 25  65
		try {
			String post = HttpUtil.doPost(jo.toJSONString(), url + "promotion/givePromotionPackage","application/json");
			System.out.println("givePromotionPackage========"+post);
		} catch (Exception e) {
			System.out.println("givePromotionPackage----------异常---------"+e.getMessage());
		}
	}
	
	/**
	 * 可领取礼包
	 */
	public static void preLoadPromotionPackages() {
		JSONObject jo = new JSONObject();
		jo.put("accepter", 375763);
		try {
			String post = HttpUtil.doPost(jo.toJSONString(), url + "promotion/preLoadPromotionPackages","application/json");
			System.out.println("preLoadPromotionPackages========"+post);
		} catch (Exception e) {
			System.out.println("preLoadPromotionPackages----------异常---------"+e.getMessage());
		}
	}
	
	/**
	 * 领取礼包
	 */
	public static void getPromotionPackages() {
		JSONObject jo = new JSONObject();
		jo.put("accepter", 375763);
		try {
			String post = HttpUtil.doPost(jo.toJSONString(), url + "promotion/getPromotionPackages","application/json");
			System.out.println("getPromotionPackages========"+post);
		} catch (Exception e) {
			System.out.println("getPromotionPackages----------异常---------"+e.getMessage());
		}
	}

}
